<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<script type="text/javascript">
function createXmlHttp(){
	var xmlHttp=null;
	try{
		xmlHttp=new XMLHttpRequest();
	}
	catch(e){
		try{
			xmlHttp=new ActiveXObject("microsoft.xmlhttp");
		}
		catch(e1){
			try{
				xmlHttp=new ActiveXObject("msxml2.xmlhttp");
				//xmlHttp=new ActiveXObject("msxml2.xmlhttp.3.0");
				//xmlHttp=new ActiveXObject("msxml2.xmlhttp.5.0");
				//xmlHttp=new ActiveXObject("msxml2.xmlhttp.6.0");
			}
			catch(e2){
			}
		}
	}
	return xmlHttp;
}
function testAjax(){
	var xmlHttp=createXmlHttp();
	if(xmlHttp){
		xmlHttp.open("get","demo-01.jsp?"+Math.random(),true);
		xmlHttp.send(null);
		xmlHttp.onreadystatechange=function(){
			if(xmlHttp.readyState==4){
				if(xmlHttp.status==200){
					var result=xmlHttp.responseText;
					alert(result);
				}
			}
		};
	}
	else{
		alert("你的IE版本太旧了！不支持Ajax");
	}
}
</script>
</head>
<body>
<input type="button" value="测试Ajax交互" onclick="testAjax()"/>
</body>
</html>